<template>
  <div class="main">
    <el-container class="main-container">
      <el-aside :width="isFold ? '64px' : '210px'">
        <main-menu :isFold="isFold"></main-menu>
      </el-aside>
      <el-container>
        <el-header height="50px">
          <main-header @fold-change="handleFoldChange"></main-header>
        </el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup lang="ts">
import mainMenu from '@/components/main-menu/main-menu.vue';
import mainHeader from '@/components/main-header/main-header.vue';
import { LOGIN_TOKEN } from '@/global/constants';
// import useCounterStore from '@/store/counter'
import { localCache } from '@/utils/cache'
import { useRouter } from 'vue-router';
import { ref } from 'vue';

// const useCounter = useCounterStore()
const router = useRouter()

const handleExit = () => {
  // 删除token
  localCache.removeCache(LOGIN_TOKEN)
  // 跳转登录
  router.push('/login')
}

const isFold = ref(false)
const handleFoldChange = (flag: boolean) => {
  isFold.value = flag
}
</script>

<style lang="less" scoped>
.main {
  height: 100%;
  .main-container {
    height: 100%;
    .el-aside {
      overflow-x: hidden;
      overflow-y: auto;
      transition: width 0.3s linear;
      background-color: #001529;

      &::-webkit-scrollbar {
        display: none;
      }
    }
    .el-header {
      background: skyblue;
    }
    .el-main {
      background: #f0f2f5;
    }
  }
}
</style>
